package cn.jdx.controller;

import cn.jdx.entity.Store;
import cn.jdx.service.StoreService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.DispatcherServlet;

import javax.annotation.Resource;
import javax.tools.Diagnostic;
import java.util.List;

@Controller //声明当前类是个控制器
@RequestMapping("/store")
public class StoreController {
    //http://localhost:8080/ssm_01/store/show

    @Resource
    private StoreService service;

    @RequestMapping("/show")
    public String showAll(Model model){
        List<Store> stores = service.selectByExample(null);
        for (Store store : stores) {
            System.out.println(store);
        }
        model.addAttribute("list",stores);
        return "show";//这个就是逻辑视图名(被视图解析器处理)
    }


}
